function A_inv = my_inverse(A)

[m,n] = size(A);
    if n>=m
        unit_matrix = eye(m);
        inverse_H = zeros(n,m);
        iter = 0;
        [H C]= Schmidt111(A);
        for k = 1 : m
            T = unit_matrix(:,k);
            [Beta, errors] = minSolve(H, T, 1000, 1e-7);
            inverse_H(:,k) = Beta;
            iter = iter + length(errors);

        end
        A_inv = C * inverse_H;

        iter
        if iter >3*n
        iter
        end
    else
        A= A';
        [m,n] = size(A);
        unit_matrix = eye(m);
        inverse_H = zeros(n,m);
        iter = 0;
        [H C]= Schmidt111(A);
        for k = 1 : m
            T = unit_matrix(:,k);
            [Beta, errors] = minSolve(H, T, 1000, 1e-7);
            inverse_H(:,k) = Beta;
            iter = iter + length(errors);

        end
        A_inv = (C * inverse_H)';
        iter
    end
end